<?php
// MySmartBB 1.5.0 Patch 1

// #################################################################### ||
// #                                                                  # ||
// #   MySmartBB Version 1.5.0                                        # ||
// #   http://www.MySmartBB.com                                       # ||
// #   Copyright (c) 2005 by MySmartBB team                           # ||
// #                                                                  # ||
// #   filename : users-reply.php                                     # ||
// #   To see who's submit reply in this subject                      # ||
// #                                                                  # ||
// #################################################################### ||

// ** General definitions **

     define('NO_HEADER', 1);
     include('common.php');
    if ($_GET['users'] == 1)
    {
            $id = intval($_GET['id']);
            $replys = $DB->sql_query("SELECT writer FROM " . $db_prefix . "reply WHERE subject_id = '" . $id . "' AND delete_topic != '1' ORDER BY id ASC");
            $Count_replys = $DB->sql_num_rows($replys);
            $Smarty->assign('count_reply',$Count_replys);
            $replys2 = $DB->sql_query("SELECT DISTINCT writer FROM " . $db_prefix . "reply WHERE subject_id = '" . $id . "' AND delete_topic != '1' ORDER BY id ASC");

            $users_row = array();
            $replys_user_count = array();

              while ($users = $DB->sql_fetch_array($replys2)){
                      $replys_user_count[] = $DB->sql_num_rows($DB->sql_query("SELECT * FROM " . $db_prefix . "reply WHERE subject_id = '" . $id . "' AND delete_topic != '1' AND writer = '" . $users['writer'] . "' ORDER BY id ASC"));
                      $users_row[] = $users;
                      $Smarty->assign('users_row',$users_row);
                      $Smarty->assign('replys_user_count',$replys_user_count);
              }
            $Smarty->assign('subjedt_id',$id);
     $Smarty->display('section_members-replies.tpl');
    }

?>